<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>page</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
<button onclick="testGet()">发送GET请求</button>
<button id="ccc">GET</button>
</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

<script>
  const btns = document.querySelectorAll('button');
  axios.defaults.baseURL = 'http://127.0.0.1:8000';
  btns[0].onclick = function () {
    axios.get('/api')
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
  }
</script>
</html>
